﻿@using Aspire.Dashboard.Resources

@inject IStringLocalizer<ControlsStrings> Loc

<FluentInputLabel
    Label="@Loc[nameof(ControlsStrings.ResourceLabel)]"
    ForId="@_selectId"
    Orientation="Orientation.Horizontal" />

<FluentSelect Items="Resources"
              Id="@_selectId"
              OptionValue="@(c => c!.Name)"
              OptionDisabled="@(c => !CanSelectGrouping && c!.Id?.Type is Otlp.Model.OtlpApplicationType.ResourceGrouping)"
              @bind-SelectedOption="SelectedResource"
              @bind-SelectedOption:after="SelectedResourceChangedCore"
              ValueChanged="ValuedChanged"
              AriaLabel="@AriaLabel"
              Class="resource-list"
              Height="@GetPopupHeight()">
    <OptionTemplate>
        <ResourceSelectOptionTemplate ViewModel="@context" />
    </OptionTemplate>
</FluentSelect>
